function Map(){
	this.obj = {};
}
Map.prototype.put = function(key,value){
	this.obj[key]=value;
}
Map.prototype.get = function(key){
	return this.obj[key];
}
/**
 * 转成请求格式
 */
Map.prototype.toString = function(){
	var obj = this.obj;
	if(!obj) return "";
	var str = "";
	for(var i in obj){
		var current = obj[i];
		if(str.length > 0){
			str += "&";
		}
		str +=i+"="+obj[i];
	}
	return str;
}

/**
 * 转成请求格式
 */
Map.prototype.toString4JFinal = function(){
	var obj = this.obj;
	if(!obj) return "";
	var str = "";
	for(var i in obj){
		var current = obj[i];
		if(str.length > 0){
			str += "-";
		}
		str +=obj[i];
	}
	return str;
}

/**
 * 发送ajax请求
 * sync是否同步，默认异步
 */
function ajaxRequest(url,map,callback4succ,callback4fail,sync){
	var data = "";if(map) data = map.toString();
	$.ajax({
	   type: "POST",
	   url: url,
	   async: !sync,
	   data: data ,
	   success: function(msg){
	  	 var responseObj = {
	  			 getJson : function(){
	  				 if(typeof msg == "object"){
	  					 return msg;
	  				 }
	  				 return JSON.parse(msg);
	  			 },
	  			 getText : function(){
	  				 if(typeof msg == "object"){
	  					 return JSON.stringify(msg);
	  				 }
	  				 return msg;
	  			 },
	  			 originObj : msg
	  	 }
	  	 callback4succ(responseObj);
	   },
	   error : callback4fail,
	});
}